#include <cstdio>

bool visit[ 10 ];
int minn, n, m, a[ 10 ], v[ 10 ];

void dfs( int d, int step )
{
    int i;
    if ( step >= minn )
        return ;
    if ( d <= 0 )
    {
        minn = step;
        return ;
    }
    for ( i = 0; i < n; i++ )
        if ( !visit[ i ] )
        {
            visit[ i ] = true;
            if ( d <= v[ i ] )
                dfs( d - a[ i ] * 2, step + 1 );
            else
                dfs( d - a[ i ], step + 1 );
            visit[ i ] = false;
        }
}

int main( )
{
    int i;
    while ( scanf("%d%d", &n, &m) != EOF )
    {
        for ( i = 0; i < n; i++ )
        {
            visit[ i ] = false;
            scanf("%d%d", &a[ i ], &v[ i ]);
        }
        minn = 0xfffffff;
        dfs( m, 0 );
        if ( minn == 0xfffffff )
            puts("-1");
        else
            printf("%d\n", minn);
    }
    return 0;
}
